package com.blb.community.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blb.community.entity.SysDictType;
import com.blb.community.entity.vo.DictTypeVo;
import com.blb.community.mapper.SysDictTypeMapper;
import com.blb.community.service.ISysDictTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 字典类型表 服务实现类
 * </p>
 *
 * @author 帅帅
 * @since 2022-07-02
 */
@Service
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService {

    @Resource
    private SysDictTypeMapper sysDictTypeMapper;


    @Override
    public IPage<SysDictType> getDictTypePage(DictTypeVo dictTypeVo,IPage<SysDictType> page) {
        return sysDictTypeMapper.selectDictTypeAll(page,dictTypeVo);
    }

    /**
     * 按條件查詢字典
     * @return
     */
    @Override
    public List<SysDictType> selectDictTypeList(SysDictType sysDictType) {
        return sysDictTypeMapper.selectDictTypeList(sysDictType);
    }

    /**
     * 添加字典类型
     * @param sysDictType
     * @return
     */
    @Override
    public String insertDictType(SysDictType sysDictType) {
        sysDictTypeMapper.insertDictType(sysDictType);
        return "添加成功";
    }

    /**
     * 逻辑删除单个字典类型
     * @param id
     */
    @Override
    public void logicDeleteDictType(Long id) {
        sysDictTypeMapper.logicDeleteDictType(id);
    }
}
